package com.test.mapper;

import com.test.pojo.example;
import org.apache.ibatis.annotations.*;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @Description mapper接口
 * @Author Mr.Li
 * @Date 2020/3/10 11:56
 */
@Configuration
public interface ExampleMapper {
    /**
    *@Description: 查询全部
    *@Params
    *@Return
    *@Author Mr.Li
    *@Date 2020/3/10 12:38
    */
    @Select("select * from tb_ssm")
    List<example> selectAll();
    /**
    *@Description: 删除
    *@Params
    *@Return
    *@Author Mr.Li
    *@Date 2020/3/10 12:38
    */
    @Delete("delete from tb_ssm where id=#{id}")
    int deleteExampleById(Integer id);
    /**
    *@Description: 修改
    *@Params
    *@Return
    *@Author Mr.Li
    *@Date 2020/3/10 12:38
    */
    @Update("UPDATE tb_ssm SET sname=#{example.StudentName},age=#{example.age} WHERE id=#{example.id}")
    int updateExampleById(@Param("example")example example);
    /**
    *@Description: 新增
    *@Params
    *@Return
    *@Author Mr.Li
    *@Date 2020/3/10 12:39
    */
    @Insert("INSERT INTO tb_ssm VALUES(#{example.id},#{example.StudentName},#{example.age})")
    int addExample(@Param("example") example example);
}
